package com.web.mall.repository;

import com.web.mall.document.EsGoods;
import com.web.mall.pojo.TbGoods;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface EsGoodsRepository extends ElasticsearchRepository<EsGoods,Long> {

    @Query("{\"multi_match\": {\n" +
            "      \"query\": \"?0\",\n" +
            "      \"fields\": [\"title\",\"category\"]\n" +
            "    }}")
    public Page<EsGoods> findByKeyword(String key, Pageable pageable);


}
